<template>
  <div>
    <div class="personalInfo-header">
      <div class="function-title" v-text="functionTitle" />
    </div>
    <div>
      <div class="um-order-course-box" v-for="course in list" :key="course.id">
        <div class="um-order-course_clist">
          <div class="um-order-course_row f-cb">
            <div class="f-fl um-order-course_name" style="width: 80%">
              <div class="um-order-course_cell">
                <div class="um-order-course_cell_image f-ib f-vat">
                  <a
                    :href="'/course/'+course.id"
                    target="_blank"
                    class="f-db"
                    ><img
                      :src="course.cover"
                      :alt="course.title"
                      class="um-order-course_img"
                  /></a>
                </div>
                <div class="um-order-course_names f-ib f-vat">
                  <a
                    :href="'/course/'+course.id"
                    target="_blank"
                    class="f-db"
                    ><h5 class="um-order-course_cname">
                      <span v-text="course.title"></span>
                    </h5>
                    <h5 class="um-order-course_desc">
                      <span v-html="course.description"></span>
                    </h5>
                    </a>
                  <span class="um-order-course_tname"></span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// import { userInfo, updateUser } from "@/api/user.js";
import member from "@/api/member";
import order from "@/api/order";
import cookie from "js-cookie";

export default {
  data() {
    return {
      memberId: null,
      list: null,
      functionTitle: "我的课程",
    };
  },
  created() {
    this.token = cookie.get("user_token");
    const jsonStr = cookie.get("user_ucenter");
    if (this.$route.params.id !== undefined) {
      this.memberId = this.$route.params.id;
      this.load();
    } else if (jsonStr) {
      this.member = JSON.parse(jsonStr);
      this.memberId = this.member.id;
      this.load();
    }
    this.memberInfo = this.member;
  },
  methods: {
    load() {
      order.getCourseBymemberId(this.memberId).then((resp) => {
        this.list = resp.data.data.courseInfo;
        console.log(this.list);
      });
    },
  },
};
</script>

<style scope>
.personalInfo-header {
  width: 100%;
  height: 50px;
  position: relative;
  border-bottom: 1px solid rgb(204, 208, 224);
}
.function-title {
  position: absolute;
  left: 30px;
  font-size: 16px;
  font-weight: 600;
  line-height: 50px;
}
.um-order-course {
  -webkit-border-radius: 0 0 8px 8px;
  border-radius: 0 0 8px 8px;
  margin: 0 32px;
}
.um-order-course-box {
  background: rgba(64, 175, 255, 0.04);
  -webkit-border-radius: 8px;
  border-radius: 8px;
  padding: 0 24px;
}
.um-order-course_row {
  border-bottom: 1px solid #e6e6e6;
  min-height: 104px;
  padding-top: 20px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.um-order-course_row .um-order-course_cell {
  padding: 0;
  height: 50px;
  font-size: 14px;
}
.f-fl {
  float: left;
}
.f-ib {
  display: inline-block;
  zoom: 1;
  /* display: inline; */
}
.um-order-course_img {
  width: 100px;
  height: 63px;
  -webkit-border-radius: 8px;
  border-radius: 8px;
}
.um-order-course_row .um-order-course_names {
  margin-left: 0 !important;
  position: relative;
}
.um-order-course_row .um-order-course_tname {
  display: block;
  font-size: 14px;
  margin-left: 15px;
  margin-top: 3px;
  color: #ff7a3e;
}
.um-order-course_row .um-order-course_cname {
  font-size: 14px;
  color: #333333;
  position: absolute;
  bottom: 23px;
  width: 130px;
}
.um-order-course_desc {
  font-size: 14px;
  color: #7b7878b8;
  position: absolute;
  bottom: 5px;
  width: 530px;
  height: 15px;
  overflow: hidden;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 500;
  font-family: "Arial", "Hiragino Sans GB", "Microsoft YaHei",
    \5fae\8f6f\96c5\9ed1, "Helvetica", "sans-serif";
  line-height: 1.5;
}
a,
a:hover {
  text-decoration: none;
}
</style>
